<?php 
class AclUsersModel extends Zwei_Db_Table
{
	protected $_name = "acl_users";
	protected $_name_roles = "acl_roles";
	protected $_generate_pass = "user_name";
	
	public function select(){
		//Zwei_Utils_Debug::write($this->_user_info);
		$select=new Zend_Db_Table_Select($this);
		$select->setIntegrityCheck(false); //de lo contrario no podemos hacer JOIN
		$select->from($this->_name)
				->joinLeft($this->_name_roles, "$this->_name.acl_roles_id = $this->_name_roles.id", "role_name")
		;
		
		//[TODO] esto está en duro, debiera ser dinámico via campo root en acl_roles
		if($this->_user_info->acl_roles_id != '1'){
			$select->where('acl_roles_id <> ?', '1');
		}
		
		return $select;		
	}
}
?>